
#include "wm_LibeventServer.h"
#include "wm_RaknetServer.h"
#include "wormnet/wm_std.h"
#include "wormnet/IServerModule.h"
#include "wormnet/wm_Exception.h"

namespace worm
{

WORM_DLL_EXPORT class wmServer* ICreateServerModule(const wmESupportNetType& eNetType)
{
    wmServer* pServer = NULL;

    switch(eNetType)
    {
    case WM_NET_TYPE_LIBEVENT:
        pServer = new(wmLibeventServer);
        break;
    case WM_NET_TYPE_RAKNET:
        pServer = new(wmRaknetServer);
        break;
    default:
        throw wmException("ICreateServerModule: server type (%u) unknow\n", eNetType); 
        return NULL;
    }

    return pServer;
}

WORM_DLL_EXPORT void IReleaseServerModule(class wmServer*& pServer)
{
    delete pServer;
    pServer = NULL;
}

}
